<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="renderer" content="webkit">
    <title>无标题文档</title>
    <style type="text/css">
        *{margin:0; padding:0; text-decoration:none;}
        .all{ background:#fff;width:95%; padding:5% 0; border-radius: 20px;
            margin: 5% auto;}
        ul{ list-style:none;}
        .content{ border:1px solid #ccc; margin:5% auto; width:60%;}
        .top{ border-bottom:1px solid #ccc; overflow:hidden;}
        .top h4{ float:left; margin:2%;}
        .top a{ float:right; margin:2% 2% 2% 0; color:#000; font-size:15px;}
        .top a:hover{ text-decoration:underline;}
        .top a i{ display:inline-block; background:url(<{$ipath}>wx/images/base_z2968da.png) no-repeat -1px -6244px; width:14px; height:15px; margin-left:5px;}
        .s_list{ overflow:hidden;}
        .s_list a{ color:#fff; float:right; background:#0C6; display:block; padding:1% 2%; border-radius:10%; margin:2%;}
        .s_table{ border:1px solid #ccc; margin:8% auto; width:90%; font-size:14px;}
        .s_table th{ background:#ddd; padding:1% 0;}
        .s_table td{ text-align:center; padding:1% 0;position: relative}
        .detail{ margin-right:30% !important;}
        .confirm{ margin:10px auto; border:1px solid #ccc; width:20%;height:150px; position:absolute; top:250px; left:819px; background:#fff; display:none;}
        .confirm i{ display:block; background:url(<{$ipath}>wx/images/base_z2968da.png) -2px -3440px no-repeat;width:10px; height:6px; left:55%; position:relative;}
        .confirm p{ margin:20px 20px;}
        .confirm a{ display:inline-block; width:25%; height:30px; background:#44b549; color:#fff; text-align:center; line-height:30px; border-radius:10%; margin-left:15%}
        .button{margin-top:18px;height:25px;width:70px;background-color:#00CC66;border: none;color: white;}
        .file-style3{
            width:100px;
            height:20px;
            line-height:20px;
            display:block;
            background:#009118;
            color:#FFF;
            border-radius:4px;
            cursor:pointer;
            text-align:center;
            font-size:14px;
            text-decoration:none;
            float:left;
        }
        .file-style3-input{
            display:none;
        }
        .upload{
            position: absolute;
            top: 60%;
            left: 37%;
            display: none;
            display: inline-block;
            height: 40px;
            width: 115px;
            opacity: 0;
        }
        .call_url{ margin-left: 20%;margin-top: 5%;
            float: left;}
    </style>
    <script src="<{$ipath}>wx/js/jquery.min.js"></script>
    <script src="<{$ipath}>wx/js/ajaxfileupload.js"></script>
    <script src="<{$ipath}>wx/js/ajaxfileuploadbk1.js"></script>
    <script>

        //下面用于图片上传预览功能
        function setImagePreview(avalue) {
            document.getElementById('textfield').value=document.getElementById('doc').value;
            var docObj=document.getElementById("doc");

            var imgObjPreview=document.getElementById("preview");
            if(docObj.files &&docObj.files[0])
            {
//火狐下，直接设img属性
                imgObjPreview.style.display = 'block';
                imgObjPreview.style.width = '83px';
                imgObjPreview.style.height = '83px';
//imgObjPreview.src = docObj.files[0].getAsDataURL();

//火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
                imgObjPreview.src = window.URL.createObjectURL(docObj.files[0]);
            }
            else
            {
//IE下，使用滤镜
                docObj.select();
                var imgSrc = document.selection.createRange().text;
                var localImagId = document.getElementById("localImag");
//必须设置初始大小
                localImagId.style.width = "83px";
                localImagId.style.height = "83px";
//图片异常的捕捉，防止用户修改后缀来伪造图片
                try{
                    localImagId.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
                    localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
                }
                catch(e)
                {
                    alert("您上传的图片格式不正确，请重新选择!");
                    return false;
                }
                imgObjPreview.style.display = 'none';
                document.selection.empty();
            }
            return true;
        }




        $(function(){
            $(".file-style3").click(function() {
                var picid = $(".file-style3-input").attr('id');
                $.ajaxFileUpload({
                    url:'?g=wx&m=wxvote&a=up_img',
                    dataType:'json',
                    fileElementId:picid,
                    type:'post',
                    secureuri:false,
                    success:function(data) {
                        alert("6666");
                        console.log(data['pic']);
                        if (data.error == 1000 || data.error == '1000') {
                            $(".call_url").attr('src', data['pic']);
                        }
                    }
                })
            });
        });
    </script>
    <script>
        $(function(){
            $(".wordbox").blur(function(){
                var inputcard=$(".wordbox").val();
                var reg="^[0-9a-zA-Z]{6,16}$";
                var r = inputcard.match(reg);
                if(r==null || r==""){
                    alert("请输入6-16位密码！");
                    $(".wordbox").val("");
                    return;
                }
            });
        })
    </script>
</head>

<body>
<form action="?g=wx&m=weixin&a=update_kf" method="post" enctype="multipart/form-data">
    <div class="all">
        <div class="content">
            <div class="top">
                <h4>添加客服工号</h4>
            </div>
            <div class="s_list">
                <a href="?g=wx&m=weixin&a=show_kf">客服工号列表</a>
                <table cellspacing="0" class="s_table" cellpadding="10"  >
                    <tr>
                        <td style="text-align:right;width: 150px;">头像</td>
                        <td style="height:100px;text-align:">
                            <img src="<{$data_kefu['img_url']}>" class="call_url" id="preview" style="width:90px;height:70px;"/>
                            <a href="" class="file-style3" name="img_url" style="float: left;margin-left: 3%;margin-top: 13%;">上传头像</a>
                            <p style="float: left;margin-top: 13%;">(jpg格式，建议大小:640*640)</p>

                            <input type="hidden" class="file-style3-input" id="textfield"  />
                            <input type="file" class="upload" id="doc" name="img_url"  onchange="setImagePreview()"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;width: 150px;">工号</td>
                        <td style="height:100px;text-align: left;text-indent: 120px;">
                           <input type="text"value="<{$data_kefu['em_id']}>" name="em_id" style="width:250px;height:25px;margin-left:6px;border: medium none;"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;width: 150px;">昵称</td>
                        <td style="height:80px;">
                            <input type="text" style="width:250px;height:25px;margin-left:-80px" name="nick" value="<{$data_kefu['nick']}>"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;width: 150px;">密码</td>
                        <td style="height:80px;">
                            <input type="password" class="wordbox" style="width: 250px;height: 25px;margin-left: -80px;" name="password" value="<{$data_kefu['password']}>"/>
                            <span style="display:block;color:#ccc;margin-top:10px;margin-left:-200px;" class="pass">请输入6-16位的密码</span>
                        </td>
                    </tr>

                </table>
            </div>
            <div class="bottom_tianjia" style="height:50px;border-top:1px solid #ccc;text-align:center;" />
            <input type="hidden" name="id" value="<{$data_kefu['id']}>" />
            <input type="submit" value="确定修改" class="button"/>
            <input type="button" value="取消" class="button" onclick="window.history.go(-1)"/>
        </div>
    </div>
    </div>
</form>
</body>
</html>